package com.ruoyi.web.controller.clinic;

import com.ruoyi.clinic.dto.ClinicDistrictReqDTO;
import com.ruoyi.clinic.service.IClinicProvinceService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 省市区Controller
 *
 * @author Tommy
 * @date 2025-11-08
 */
@Controller
@RequestMapping("/clinic/province")
public class ClinicProvinceController extends BaseController {

    @Autowired
    private IClinicProvinceService clinicProvinceService;

    /**
     * 查询省市数据
     */
    @PostMapping("/queryClinicProvinceCityList")
    @ResponseBody
    public AjaxResult queryClinicProvinceCityList() {
        return success(clinicProvinceService.queryClinicProvinceCityList());
    }

    /**
     * 查询省市区数据
     */
    @PostMapping("/queryClinicProvinceCityDistrictList")
    @ResponseBody
    public AjaxResult queryClinicProvinceCityDistrictList() {
        return success(clinicProvinceService.queryClinicProvinceCityDistrictList());
    }

    /**
     * 根据城市ID查询县区
     *
     * @return 响应数据
     */
    @PostMapping(value = "/queryDistrictListByCityId")
    @ResponseBody
    public AjaxResult queryDistrictListByCityId(ClinicDistrictReqDTO reqDTO) {
        return success(clinicProvinceService.queryDistrictListByCityId(reqDTO));
    }
}
